# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php81-pecl-memcache
_extname=memcache
pkgver=8.2
pkgrel=1
pkgdesc="PHP 8.1 memcache extension, provides handy OO and procedural interfaces, can be used as session handler - PECL"
url="https://pecl.php.net/package/memcache"
arch="all"
license="PHP-3.0"
_phpv=81
_php=php$_phpv
depends="$_php-session"
makedepends="$_php-dev"
source="php-pecl-$_extname-$pkgver.tgz::https://pecl.php.net/get/$_extname-$pkgver.tgz"
builddir="$srcdir/$_extname-$pkgver"

install_if="php-$_extname php$_phpv"

build() {
	phpize$_phpv
	./configure --prefix=/usr --with-php-config=php-config$_phpv
	make
}

check() {
	# Tests require 3 memcached servers, basic check, see tests/memcache.sh
	$_php -dextension=modules/$_extname.so --ri $_extname
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	local _confdir="$pkgdir"/etc/$_php/conf.d
	install -d $_confdir
	echo "extension=$_extname" > $_confdir/$_extname.ini
}

sha512sums="
937f6bf33cd9202751585a2817c658bb2d361b0cef013cb6ac17ee147e07a1ca7860dc73902a607a147cd7ecfaf50cc0f3cb6758338afd29e688bc85ca59a2ba  php-pecl-memcache-8.2.tgz
"
